package blog.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;
import com.service.CommentService;

import blog.entity.Comment;

@Controller
@RequestMapping("/admin/comment")
public class CommentController {
	
	
	@Autowired 
	private CommentService commentService;
	/**
	 * 	查询所有评论
	 * @param pageIndex
	 * @param pageSize
	 * @param model
	 * @return
	 */
	@RequestMapping("")
	public String commentList(
			@RequestParam(required=false,defaultValue="1") Integer pageNum,
			@RequestParam(required=false,defaultValue="10")  Integer pageSize,
			Map<String,Object> model) {
		PageInfo<Comment> commentList =commentService.commentList(pageNum,pageSize);

		model.put("pageInfo", commentList);
		model.put("pageUrlPrefix", "admin/comment?pageIndex"); 
		
		return "Comment/comment-list";
	}
}
